Contents | Index | < Browse | Browse >

LETTERsrandULETTER Sets a seed for the random numbers generator.

Overview
#include <stdlib.h>

(void) srand(seed);

unsigned int seed;

Portability
ANSI

Description
The algorhytm used by the rand function of course always returns the same sequence of random numbers. You can influence it however by using this function to set a new seed value "seed" which is used to generate these numbers. You should re-set the seed each time your program runs, eg. using the computer's current time.

See also
rand , time